package test01;

import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: YKH
 * Date: 2022-05-08
 * Time: 20:09
 * author:Test01
 */
public class Test01 {
    public static void main1(String[] args) {
        MyFrame frame = new MyFrame("测试窗口",100,100,500,400,Color.red);
        frame.setLayout(null);
       JPanel panel = new JPanel();
       panel.setBounds(200,150,150,100);
        JButton button1 = new JButton("点击");
        panel.setLayout(null);
        button1.setBounds(1,1,150,100);
        button1.setBackground(new Color(250, 246, 238, 255));
        panel.add(button1);
        frame.add(panel);
        frame.setVisible(true);

    }

    public static void main(String[] args) {
        //创建窗口
        MyFrame frame = new MyFrame("登录",100, 100, 510, 500,new Color(65, 113, 218));
        //创建标签
        createLable("欢迎来到图书管理系统");
        frame.add(label);
    }

    public static void createLable(String name) {
        JLabel label = new JLabel(name);

        label.setBounds(90, 30, 400, 40);
        label.setFont(new Font("宋体", Font.BOLD, 30));
        label.setText("欢迎来到图书管理系统");

    }
}
class MyFrame extends JFrame {
    public MyFrame(String name,int x,int y,int heigh,int weigh,Color color) {
        super(name);
        getContentPane().setBackground(color);
        Image image = new ImageIcon("img.jpg").getImage();
        setIconImage(image);
        setBounds(x,y,heigh,weigh);
        setVisible(true);
        setLayout(null);
    }
}